
/**
 * AppleIIGo
 * Floppy Disk Drive class
 * (C) 2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */

#ifndef FLOPPYDISKDRIVE_H
#define FLOPPYDISKDRIVE_H

#include "DiskPort.h"
#include "FloppyDiskImage.h"

class FloppyDiskDrive : public DiskPort {
public:
	FloppyDiskDrive(UINT32 diskDriveType);
	~FloppyDiskDrive();
	
	bool mount(char * diskImagePath);
	void unmount();
	char * getDiskImagePath();
	
	void setPhaseRegister(UINT32 value);
	void setDriveEnabled(bool value);
	
	void updateSendBitNum(UINT32 * value);
	void sendBit(bool value);
	void updateReceiveBitNum(UINT32 * value);
	bool receiveBit();
	void discardBits(UINT32 bitNum);
	
protected:
	class FloppyDiskImage * diskImage;
	
	UINT32 phaseRegister;
	
	bool isDriveEnabled;
	bool isWriteEnabled;
	bool isDiskModified;
	
	UINT32 trackBitNum;
	UINT32 trackBitIndex;
	UINT8 * trackData;
	
	UINT32 zeroBitCount;
	
	void updateDiskTrack();
	
	void getMC3470SpuriousBit(bool * value);
};

#endif
